package com.nsl.my_youlai.fast2json_demo;

import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.reader.ObjectReader;

import java.lang.reflect.Type;
import java.math.BigDecimal;


public class MyBigDecimalReader implements ObjectReader<BigDecimal> {

    public static final MyBigDecimalReader INSTANCE = new MyBigDecimalReader();
    @Override
    public BigDecimal readObject(JSONReader jsonReader, Type type, Object fieldName, long l) {
//        Number number=jsonReader.getNumber();
//        System.out.println(number);
        if(jsonReader.nextIfNull()){
            System.out.println("in null");
            return null;
        }


        System.out.println(type);
        System.out.println(fieldName);
        return jsonReader.readBigDecimal();
    }

}
